POV-Ray : Newsgroups : povray.newusers : Candy cane torus pattern : Candy cane torus pattern Server Time
31 Jul 2024 06:12:14 EDT (-0400)
  Candy cane torus pattern  
From: hrisedorph
Date: 20 Dec 2002 17:15:09
Message: <web.3e0394626c2b88df6e6484130@news.povray.org>
I've looked in the documentation, on these newsgroups, and tried several
different mappings...

What I want to do is make a candy cane. I set up the gradient map for the
straight parts, but in the hook part, I can't get it to look right. I
*could* just use one overall pattern, but it's not really ... it just sort
of goes diagonally across the ring instead of winding around it. I'm pretty
new to this, so when I found a news post that basically tells exactly how
to make it, I didn't understand what was meant.

The post is at:
http://news.povray.org/povray.programming/17265/110301/#110301

Here's my code (replace the ! with vector brackets ... it was doing
something weird with them for some reason):

// obligatory header code
#include "textures.inc"
#include "finish.inc"
background { color rgb 1 }
camera { location <0,10,3> look_at <0,0,3> }
light_source { <5,5,3> color rgb 1 }

// size settings
#declare CC_t = .25;
#declare CC_a = 1.0;
#declare CC_l = 6.5;

// working, nice looking, stripes for the straight candy pieces
#declare CC_stripe = texture {
  pigment {
    gradient x+z
    color_map {
          [0.0000 color rgb 1]
          [0.1117 color rgb 1]
          [0.1117 color red 0.74 green 0.00 blue 0.00]
          [0.4117 color red 0.74 green 0.00 blue 0.00]
          [0.4117 color rgb 1]
          [0.6350 color rgb 1]
          [0.6350 color red 0.74 green 0.00 blue 0.00]
          [0.6550 color red 0.74 green 0.00 blue 0.00]
          [0.6550 color rgb 1]
          [0.8683 color rgb 1]
          [0.8683 color red 0.74 green 0.00 blue 0.00]
          [0.8883 color red 0.74 green 0.00 blue 0.00]
          [0.8883 color rgb 1]
          [1.0000 color rgb 1]
    }
  }
  finish { Phong_Dull }
}

// this part I don't know how to do
#declare CC_stripe_arc = texture { ? ? ? }

// the CSG makes a nice looking candy cane shape
#declare CandyCane = union {
  difference {
    torus { CC_a, CC_t texture { CC_stripe_arc } }
    box {
!CC_a+CC_t+.01,-1*(CC_t+.01),0!,!-1*(CC_a+CC_t+.01),CC_t+.01,CC_a+CC_t+.01!
}
  }
  cylinder { !CC_a,0,-.001!,!CC_a,0,CC_l!,CC_t texture { CC_stripe } }
  cylinder { !-1*CC_a,0,-.001!,!-1*CC_a,0,CC_a/2!,CC_t texture { CC_stripe }
}
  sphere { !-1*CC_a,0,CC_a/2!,CC_t texture { CC_stripe } }
  sphere { !CC_a,0,CC_l!,CC_t texture { CC_stripe } }
}

// put the test object in the scene
object { CandyCane }

I tried using the function code put on the news post that was indicated by
the URL above, but it keeps asking for a parameter or float constant, and
when I put in fmod 1.0 or 1.0 it tells me it wasn't expecting a float
constant. I tried to follow the function documentation ... function { x + y
+ z } is listed in the documentation, but function { /* complex function
using atans */ } gave a parsing error. It's frustrating when all I want to
do is match the stripes on the torus to the straight pieces.

(This is my first post so if my ettiquette is bad let me know ... I have to
use web view because I only have 'net at work so I'm limited to no
attachments)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.